package com.webchat.rmi.interceptor;

import com.webchat.common.constants.RpcRequestConstants;
import com.webchat.rmi.aigc.AIMallServiceClient;
import com.webchat.rmi.ugc.mall.im.MallAiBotClient;
import feign.RequestInterceptor;
import feign.RequestTemplate;


public class RpcRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(RpcRequestConstants.RPC_REQUEST_ACCESS_KEY, RpcRequestConstants.RPC_REQUEST_DEFAULT_AK);
        requestTemplate.header(RpcRequestConstants.RPC_REQUEST_SECRET_KEY, RpcRequestConstants.RPC_REQUEST_DEFAULT_SK);
//        String clientName = requestTemplate.feignTarget().type().getName();
//        if (clientName.equals(MallAiBotClient.class.getName()) ||
//                clientName.equals(AIMallServiceClient.class.getName())) {
//            requestTemplate.header("accept", "text/event-stream");
//            requestTemplate.header("content-type", "application/json;charset=UTF-8");
//        }
    }
}
